﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using ChatBox.Models;

namespace ChatBox.Utilities
{
  public class MessageRepositoryTemplateSelector : DataTemplateSelector
  {
    #region Public Properties

    public DataTemplate ServerTemplate { get; set; }

    public DataTemplate ChannelTemplate { get; set; }

    public DataTemplate NullTemplate { get; set; }

    #endregion

    #region Public Methods

    public override DataTemplate SelectTemplate( object item, DependencyObject container )
    {
      DataTemplate result = this.NullTemplate;

      if ( item is ServerInfo )
      {
        result = this.ServerTemplate;
      }
      else if ( item is ChannelInfo )
      {
        result = this.ChannelTemplate;
      }

      return result;
    }

    #endregion
  }
}
